package club.cearnach.api.dao;

import club.cearnach.entity.UserRate;
import club.cearnach.entity.UserMovieId;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.Optional;

/**
 * @author 阮胜
 * @date 2018/5/31 21:22
 */
public interface IUserRateDao extends JpaRepository<UserRate, UserMovieId> {
    Page<UserRate> findByUserMovieIdMovieId(Integer movieId, Pageable pageable);
    Page<UserRate> findByUserMovieIdUserId(Integer userId, Pageable pageable);
    Optional<UserRate> findByUserMovieIdUserIdAndUserMovieIdMovieId(Integer userId, Integer movieId);
}
